package com.gjt.dlmall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.gjt.common.vaild.AddGroup;
import com.gjt.common.vaild.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;

/**
 * 品牌表
 *
 * @author gjt
 * @email g45852139@163.com
 * @date 2021-09-02 23:10:21
 */
@Data
@TableName("tb_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @NotNull(message = "修改必须指定id", groups = {UpdateGroup.class})
    @Null(message = "新增不用指定id", groups = {AddGroup.class})
    @TableId
    private Integer id;
    /**
     * 品牌名称
     */
    @NotNull(message = "品牌名称不能为空", groups = {UpdateGroup.class, AddGroup.class})
    private String name;
    /**
     * 品牌图片地址
     */
    @URL(message = "必须是合法的url地址", groups = {UpdateGroup.class, AddGroup.class})
    private String image;
    /**
     * 品牌的首字母
     */
    @NotEmpty(message = "品牌首字母不能为空", groups = {UpdateGroup.class, AddGroup.class})
    @Pattern(regexp = "^[a-zA-Z]$", message = "检索首字母必须为字母", groups = {UpdateGroup.class, AddGroup.class})
    private String letter;
    /**
     * 排序
     */
    @NotNull(message = "排序不能为空", groups = {UpdateGroup.class, AddGroup.class})
    @Min(value = 0, message = "排序必须大于等于0", groups = {UpdateGroup.class, AddGroup.class})
    private Integer seq;

}
